﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Oracle.ManagedDataAccess.Client;
using VswService_V7.Utility;

namespace VswService_V7.DataBase.Tables
{
    public partial class RECIPE_INFO
    {
        public static int pageNum = 20;

        #region field name 
        public static readonly string tableName = "RECIPE_INFO";
        public static readonly string fd_recipeName = "RECIPE_NAME";
        public static readonly string fd_recipeNo = "RECIPE_NO";
        public static readonly string fd_steelGrade = "STEEL_GRADE";
        public static readonly string fd_steelClass = "STEEL_CLASS";
        public static readonly string fd_stripThickness = "STRIP_THICKNESS";
        public static readonly string fd_stripWidth = "STRIP_WIDTH";
        public static readonly string fd_pipeOd = "PIPE_OD";
        public static readonly string fd_pipeThickness = "PIPE_THICKNESS";
        public static readonly string fd_pipeDiameter = "PIPE_DIAMETER";
        public static readonly string fd_yeildStrength = "YEILD_STRENGTH";
        public static readonly string fd_accPrPressure_1 = "ACC_PR_PRESSURE_1";
        public static readonly string fd_accPrPressure_2 = "ACC_PR_PRESSURE_2";
        public static readonly string fd_emCuttingSpd = "EM_CUTTING_SPD";
        public static readonly string fd_emChipload = "EM_CHIPLOAD";
        public static readonly string fd_sa1Power = "SA1_POWER";
        public static readonly string fd_sa1Temp = "SA1_TEMP";
        public static readonly string fd_sa1Height = "SA1_HEIGHT";
        public static readonly string fd_sa1Freq = "SA1_FREQ";
        public static readonly string fd_sa2Power = "SA2_POWER";
        public static readonly string fd_sa2Temp = "SA2_TEMP";
        public static readonly string fd_sa2Height = "SA2_HEIGHT";
        public static readonly string fd_sa2Freq = "SA2_FREQ";
        public static readonly string fd_sa3Power = "SA3_POWER";
        public static readonly string fd_sa3Temp = "SA3_TEMP";
        public static readonly string fd_sa3Height = "SA3_HEIGHT";
        public static readonly string fd_sa3Freq = "SA3_FREQ";
        public static readonly string fd_sa4Power = "SA4_POWER";
        public static readonly string fd_sa4Temp = "SA4_TEMP";
        public static readonly string fd_sa4Height = "SA4_HEIGHT";
        public static readonly string fd_sa4Freq = "SA4_FREQ";
        public static readonly string fd_hfwLineSpeed = "HFW_LINESPEED";
        public static readonly string fd_HfwPower = "HFW_POWER";
        public static readonly string fd_HfwFreq = "HFW_FREQ";
        public static readonly string fd_HfwVee_X = "HFW_VEE_X";
        public static readonly string fd_sustCw1 = "SUST_CW_1";
        public static readonly string fd_sustCw2 = "SUST_CW_2";
        public static readonly string fd_stripWdTarget = "STRIP_WD_TARGET";
        public static readonly string fd_HfwMode = "HFW_MODE";
        public static readonly string fd_HfwPreHeatPower = "HFW_PREHEATPOWER";
        public static readonly string fd_HfwTemperature = "HFW_TEMPERATURE";
        public static readonly string fd_HfwSPCGain = "HFW_SPC_GAIN";
        public static readonly string fd_HfwSPCSlope = "HFW_SPC_SLOP";
        public static readonly string fd_parameter6 = "PARAMETER_6";
        public static readonly string fd_parameter7 = "PARAMETER_7";
        public static readonly string fd_parameter8 = "PARAMETER_8";
        public static readonly string fd_parameter9 = "PARAMETER_9";
        public static readonly string fd_parameter10 = "PARAMETER_10";
        public static readonly string fd_createDate = "CREATE_DATE";
        public static readonly string fd_modifyDate = "MODIFY_DATE";
        public static readonly string fd_recipeStatus = "RECIPE_STATUS";
        public static readonly string fd_creater = "CREATER";
        public static readonly string fd_modifyUser = "MODIFY_USER";


        #endregion
        /// <summary>
        /// query recipe by index
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public static DataTable SelectRecipeByIndex(string index)
        {
            try
            {
                string sqlrecipe = string.Format("select * from {0} where {1}='{2}'",
                    tableName, fd_recipeNo, index);

                DataTable recipetable = OracleHelper.Exct_QueryTable(sqlrecipe);
                return recipetable;
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("SelectRecipeByIndex", ex);
                throw ex;
            }

        }

    }
}
